package cn.xxstudy.blog.service

import cn.xxstudy.blog.bean.BlogQuery
import cn.xxstudy.blog.entity.Blog
import org.springframework.data.domain.Page
import org.springframework.data.domain.Pageable

/**
 * 作者：wuxinxi on 2020/11/25
 * 包名：cn.xxstudy.blog.service
 * TODO:一句话描述
 */
interface IBlogService {

    /**
     * 根据title,categoryId 筛选
     */
    fun listBlog(isAdmin: Boolean, pageable: Pageable, query: BlogQuery): Page<Blog>

    /**
     * 分页查询blog
     */
    fun listBlog(pageable: Pageable): Page<Blog>

    /**
     * 根据tagId分页查询blog
     */
    fun listBlog(tagId: Long, pageable: Pageable): Page<Blog>

    /**
     * 根据条件分页查询blog
     */
    fun listBlog(query: String, pageable: Pageable): Page<Blog>

    /**
     * 热门推荐博客
     */
    fun listRecommendBlogTop(size: Int): List<Blog>

    /**
     * 最新的博客
     */
    fun listNewBlogTop(size: Int): List<Blog>

    /**
     * 根据查找博客
     */
    fun getBlog(id: Long): Blog?

    fun getBlog(isAdmin: Boolean ,id: Long): Blog?

    /**
     * 获取格式化后的blog
     */
    fun getFormatBlog(id: Long): Blog?

    /**
     * 历史
     */
    fun historyMap(): Map<String, List<Blog>>

    /**
     * 博客总数
     */
    fun blogCount(): Long

    /**
     * 存储blog
     */
    fun saveBlog(blog: Blog): Blog?

    /**
     * 修改blog
     */
    fun updateBlog(id: Long, blog: Blog): Blog?

    /**
     * 删除blog
     */
    fun deleteBlog(id: Long): Boolean
}